<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width,initial-scale=1,user-scalable=0,viewport-fit=cover">
<meta name="format-detection" content="telephone=no">
<meta name="referrer" content="never">
<style>
h3{
text-align:center;
color:#fd7299;
}
strong{
color:#fd7299;
}
.btn {
background-color: #fd7299;
border-radius:15px;
border-color: #fd7299;
color: #fff;
padding: 15px 32px;
text-align: center;
text-decoration: none;
display: inline-block;
font-size: 16px;
display: block;
margin: 0 auto;
border-radius:15px;
}
.btn:hover {
background-size: 100% 100%;
color: #fff;
}
</style>
<title>小爱音色下载</title>
</head>
<body style='background:url("https://land.xiaomi.net/mcfe/ai-personal-tts-share-fe/static/media/bg.cdfc1b2a.png") no-repeat center top;background-size:cover;background-repeat:no-repeat;background-attachment: fixed;'>
<div id="img" style='text-align: center;'><h3>加载中</h3></div>

<div style='display:block;margin:16px auto'></div>
<div id='play' style='text-align: center;display:block;margin:0px auto'></div>
<div style='display:block;margin:10px auto'>
<input id='btn' class="btn" type="button" value="添加音色" onclick="down();">
</div>
<div style='display:block;margin:10px auto'>
<input id='btn1' class="btn" style='display:none;' type="button" value="添加音色到自定义列表" onclick="down(true);">
</div>
<div style='display:block;margin:10px auto'>
<input id='btn2' class="btn" type="button" style='display:none' value="录制我的声音" onclick="Record();">
</div>
<div style='position:fixed; bottom: 10px;'><a id='qun' style='color:#fd7299;' href='https://jq.qq.com/?_wv=1027&k=5R7auqc'>小爱音色分享群：631954691</a></div>
<div style='position: absolute; bottom: 10px; right: 10px;'><a id='list' style='color:#fd7299;' href='../'>返回音色列表</a></div>
<div id='_ad'></div>
<script src="ad.js"></script>
<script type="text/javascript">document.write(unescape("%3Cspan id='cnzz_stat_icon_1278801815'%3E%3C/span%3E%3Cscript src='https://s4.cnzz.com/z_stat.php%3Fid%3D1278801815' type='text/javascript'%3E%3C/script%3E"));</script><script src="https://cdn.bootcss.com/jquery/3.4.1/jquery.min.js"></script>
<script>$('#cnzz_stat_icon_1278801815 a')[0].style.display = 'none';$('#cnzz_stat_icon_1278801815 a')[0].style.color = '#fd7299';</script>
<script>
var Base64 = {
 _keyStr: "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",
 encode: function(e) {
  var t = "";
  var n, r, i, s, o, u, a;
  var f = 0;
  e = Base64._utf8_encode(e);
  while (f < e.length) {
   n = e.charCodeAt(f++);
   r = e.charCodeAt(f++);
   i = e.charCodeAt(f++);
   s = n >> 2;
   o = (n & 3) << 4 | r >> 4;
   u = (r & 15) << 2 | i >> 6;
   a = i & 63;
   if (isNaN(r)) {
    u = a = 64
   } else if (isNaN(i)) {
    a = 64
   }
   t = t + this._keyStr.charAt(s) + this._keyStr.charAt(o) + this._keyStr.charAt(u) + this._keyStr.charAt(a)
  }
  return t
 },
 decode: function(e) {
  var t = "";
  var n, r, i;
  var s, o, u, a;
  var f = 0;
  e=e.replace(/[^A-Za-z0-9+/=]/g,"");
  while (f < e.length) {
   s = this._keyStr.indexOf(e.charAt(f++));
   o = this._keyStr.indexOf(e.charAt(f++));
   u = this._keyStr.indexOf(e.charAt(f++));
   a = this._keyStr.indexOf(e.charAt(f++));
   n = s << 2 | o >> 4;
   r = (o & 15) << 4 | u >> 2;
   i = (u & 3) << 6 | a;
   t = t + String.fromCharCode(n);
   if (u != 64) {
    t = t + String.fromCharCode(r)
   }
   if (a != 64) {
    t = t + String.fromCharCode(i)
   }
  }
  t = Base64._utf8_decode(t);
  return t
 },
 _utf8_encode: function(e) {
  e = e.replace(/rn/g, "n");
  var t = "";
  for (var n = 0; n < e.length; n++) {
   var r = e.charCodeAt(n);
   if (r < 128) {
    t += String.fromCharCode(r)
   } else if (r > 127 && r < 2048) {
    t += String.fromCharCode(r >> 6 | 192);
    t += String.fromCharCode(r & 63 | 128)
   } else {
    t += String.fromCharCode(r >> 12 | 224);
    t += String.fromCharCode(r >> 6 & 63 | 128);
    t += String.fromCharCode(r & 63 | 128)
   }
  }
  return t
 },
 _utf8_decode: function(e) {
  var t = "";
  var n = 0;
  var r = c1 = c2 = 0;
  while (n < e.length) {
   r = e.charCodeAt(n);
   if (r < 128) {
    t += String.fromCharCode(r);
    n++
   } else if (r > 191 && r < 224) {
    c2 = e.charCodeAt(n + 1);
    t += String.fromCharCode((r & 31) << 6 | c2 & 63);
    n += 2
   } else {
    c2 = e.charCodeAt(n + 1);
    c3 = e.charCodeAt(n + 2);
    t += String.fromCharCode((r & 15) << 12 | (c2 & 63) << 6 | c3 & 63);
    n += 3
   }
  }
  return t
 }
}
var u = function() {
            var e = window.navigator.userAgent
              , t = e.replace(/MicroMessenger/g, "").replace(/XiaoMi\/MiuiBrowser/g, "")
              , n = !1
              , a = !1
              , i = !1;
            /(HM|Redmi|Mi)/gi.test(t) || /2013022|2014011|2014501|tiare|TBD|raphael|monet|POCO F1\/POCO PHONE F1/.test(t) ? (n = !0,
            a = !0) : t.match(/iPhone|iPad|iPod/i) ? i = !0 : a = !0;
            var o = /(iPad|iPhone|iPod).*? (IPad)?QQ\/([\d\.]+)/.test(e) || /\bV1_AND_SQI?_([\d\.]+)(.*? QQ\/([\d\.]+))?/.test(e);
            return {
                isJ1J2: !!/(mi 10 pro)|(mi 10)|(umi)|(cmi)/i.test(e),
                isAndroid: a,
                isIOS: i,
                isXiaomi: n,
                isQQ: o,
                isSafari: /iPhone|iPad|iPod\/([\w.]+).*(safari).*/i.test(e),
                isWb: !!e.match(/weibo/i),
                isWx: !!e.match(/micromessenger/i),
                isMiuiBrowser: /MiuiBrowser/i.test(e)
            }
        }();
var json;
var h3 = document.getElementsByTagName('h3')[0];
var play = document.getElementById('play');
var btn = document.getElementById('btn');
var btn1 = document.getElementById('btn1');
var qun = document.getElementById('qun');
var list = document.getElementById('list');
var imgdiv = document.getElementById('img');
window.onload = function() {
	var text = get('text');
    var m = get('m');
    if(m != ''){
        m = decodeURIComponent(m);
        text = Base64.decode(m);
    }
    if(text == ''){
		text = localStorage.getItem('text');
	}
	if(text!=''){
		text = decodeURIComponent(text);
		json = JSON.parse(text);
        if(get('type')=='robot_push'){
            if(json.id){
                down();
            }
        }
		var name = json.name;
		var gendor = json.gendor;
		var color = json.color;
		var imgurl = json.imgurl ? json.imgurl : '';
		if(gendor){
			var gender = gendor.indexOf('female') == -1 ? '[男声]' : '[女声]';
			name = name + gender;
			if(imgurl == ''){
				imgurl = gendor.indexOf('female') == -1 ? 'icon_male_avatar.png' : 'icon_female_avatar.png';
			}
		}
		if(imgurl){
			var img = document.createElement('img');
			img.id= 'pic';
			img.style = 'margin: 0 auto;width: 120px;height: 120px;border: 2px solid '+color+';overflow: hidden;border-radius: 100%';
			img.src = imgurl;
			imgdiv.appendChild(img);
		}
		if(json.id && !json.audio){
			var audio = document.createElement('audio');
			audio.controls = true;
			audio.src = 'http://cf.wxfsq.com:86/xa/play.php?id=' + json.id;
			play.appendChild(audio);
		}
		if(json.audio){
			json.audio.forEach(function(url){
				if(url.indexOf('http') > -1){
					var audio = document.createElement('audio');
					audio.controls = true;
					audio.src = url;
					play.appendChild(audio);
				}
			});
		}
		if(color){
		console.log(color);
		h3.style.color = color;
		//btn.style.color = color;
		btn.style.borderColor = color;
		btn.style.backgroundColor = color;
		//btn1.style.color = color;
		btn1.style.borderColor = color;
		btn1.style.backgroundColor = color;
        btn2.style.borderColor = color;
		btn2.style.backgroundColor = color;
		qun.style.color = color;
		list.style.color = color;
		}
		if(json.index){
			h3.innerHTML = json.index + '.' + name;
		}else{
			h3.innerHTML = name;
		}
	}
}
function get(key) {
    url = document.location.search.substr(1);
    var arr = url.split('&');
    var arr1 = [];
    for (var i = 0; i < arr.length; i++) {
        arr1 = arr[i].split('=');
        if (arr1.length > 1)
            if (arr1[0] == key)
                return arr1[1];
    }
    return '';
}
function down(xiaofei = false){
	var id = json.id;
	if(id.length < 18){
		alert('ID错误！');
		return '';
	}
    if(xiaofei){var $type = '_xiaofei&type=xiaofei';}else{var $type = '';}
	if(u.isXiaomi || u.isJ1J2){
	        location.href='voiceassist://ttsvendor/toneSetting?vendor_id=' + id + $type;
	}else{
	        location.href='xiaoailite://main/toneSetting?vendor_id=' + id + $type;
	}
}
function Record(){
        location.href = 'voiceassist://ttsvendor/toneRecord';
}
</script>
</body>
</html>